Skip to content

id(world): torn records.namespace warns and recreates; atomic namespace write (#1544) - #2928

Merged
dezren39 merged 1 commit into
mainfrom
queue/1816-1544-torn-namespace
Oct 31, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/1816-1544-torn-namespace

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #1544 (queue task 1816).

What changed — pkgs/id/src/world_records.rs only

  • Torn namespace is no longer fatal. RecordsStore::open matched the namespace parse instead of propagating it with ?: an unparseable records.namespace (empty, garbage, crash-torn) now logs a visible warning naming the file, the error, and the recovery, then falls through to creating a fresh records doc and rewriting the namespace file — the same recovery the doc-gone case already used. The records doc is a cache recomputable from the journal, so a torn pointer file must never brick world startup (id serve's sole production caller propagates open with ?).
  • The namespace file is written atomically. New write_atomic helper (temp file in the same directory + rename, the tags::save_registry pattern), so a crash mid-write cannot leave a torn file at the real path in the first place.
  • Found while testing (same acceptance item): the doc-gone case was unreachable on iroh-docs 0.101 — Docs::open never returns Ok(None) there; a missing replica surfaces as the RPC-stringified store::OpenError::NotFound ("Replica not found"). open now treats that specific error as the gone case (warn + recreate); every other docs.open error still propagates, now with context.

Tests (laptop)

cargo test --lib world_records — 6/6 PASS, including 4 new tests:

  • open_recovers_from_an_empty_namespace_file (also asserts the file is rewritten to the new namespace)
  • open_recovers_from_a_garbage_namespace_file ("abc123partial", the creator probe's case)
  • open_reuses_the_doc_a_valid_namespace_names (happy path unchanged)
  • open_recreates_when_the_named_doc_is_gone (foreign namespace; this is the test that exposed the Replica not found behaviour above)

rustfmt clean on the touched file. Local clippy could not run: the laptop's clippy driver is rustc 1.99.0 against target artifacts built by 1.98.1 (E0514, pre-existing toolchain mismatch, unrelated to this change) — CI's lint job is the clippy gate. Out of scope per the packet: FileJournal/ArtifactLog/Outbox torn-tail semantics (#1499/#1521/#1522/#1523) untouched.

Closes #1544


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 31, 2026 03:10
@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e0b76609-c793-42eb-8acb-f6d835065be9
Commits

Reviewing files that changed from the base of the PR and between 9813b78 and 2ee999a.

Files selected for processing: 1
  • pkgs/id/src/world_records.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T03:12:15.759664Z 2ee999a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant